#!/bin/sh
PKG0=com.askey.dvr.cdr7010.dashcam
PKG1=com.askey.dvr.dashcam
show_header(){
    adb shell "dumpsys meminfo " ${PKG0} | sed -n '8,26p'| sed -n '8,14!p'|while read line
    do
        echo $line | awk '{printf $1}'
        echo $line | awk '{printf($2~/^[-]?([0-9])+[.]?([0-9])+$/)?" ":"_%s ",$2}'
    done
    echo ""
}

show_body() {
    _arg=$(date "+%H:%M:%S.000\t")
    echo $_arg|awk '{printf "%s", $0}'
    adb shell "dumpsys meminfo " ${PKG0} | sed -n '8,26p'| sed -n '8,14!p'|while read line
    do
        echo $line | awk '{printf " %d",($2~/^[-]?([0-9])+[.]?([0-9])+$/)?$2:$3}'
        # | sed -e 's/^/'$_arg'/'
    done
    echo ""
}

which_func() {
    while true; do show_body; sleep 1; done
}

show_header
which_func